# -*- coding: utf-8 -*-

from odoo import models, fields, api


class HrEXpense(models.Model):
    _inherit = 'hr.expense'

    boat_location_id=fields.Many2one('stock.location',domain=[('usage','=','internal')])

class HrExpenseSheet(models.Model):
    _inherit = 'hr.expense.sheet'


    name = fields.Char(required=False, copy=False)
    @api.model
    def create(self, vals):
        # if 'expense_line_ids' in vals and len(vals['expense_line_ids']) == 0:
        #     raise ValidationError(u'请填写报销明细的所有必填项')
        if vals.get('name', 'New') == 'New':
            vals['name'] = self.env['ir.sequence'].next_by_code('hr.expense.sheet') or '/'

        return super(HrExpenseSheet, self).create(vals)